﻿using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevUIUtils.MVVM.BaseViewModels
{
    /// <summary>
    /// Document视图基类
    /// </summary>
    [POCOViewModel]
    public abstract class BaseDocumentViewModel : BaseViewModel, IDocumentContent
    {
        /// <summary>
        /// 获取或设置拥有当前文档的服务
        /// </summary>
        [EditorBrowsable(EditorBrowsableState.Never)]
        public IDocumentOwner DocumentOwner { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        public object Title { get; protected set; }

        /// <summary>
        /// 关闭（隐藏）文档之前调用，允许终止关闭操作。
        /// </summary>
        /// <param name="e"></param>
        public virtual void OnClose(CancelEventArgs e)
        {
            //e.Cancel = true;//阻止关闭操作
            //throw new NotImplementedException();

        }

        /// <summary>
        /// 在文档关闭（隐藏）后调用。
        /// </summary>
        public virtual void OnDestroy()
        {
            //throw new NotImplementedException();
        }
    }
}
